<template>
	<view>
		<view v-if="isLogin">
			<loginInfo @send="test"></loginInfo>
		</view>
		<view v-if="!isLogin">
			<userCenter></userCenter>
		</view>
	</view>
</template>

<script>
	import loginInfo from './login'
	import userCenter from './center/index'
	export default {
		components: {
			loginInfo,
			userCenter
		},
		data() {
			return {
				isLogin: false,
				deviceId: '',
			}
		},
		onLoad() {
			console.log("页面被加载")
		},
		mounted() {
			uni.getStorage({
				key: "deviceId",
				success: res => {
					this.deviceId = res.data
					this.isLogin = false;
				},
				fail: e => {
					this.isLogin = true;
				}
			})
		},
		methods: {
			test(e) {
				this.isLogin = e;
			},
		}
	}
</script>

<style>

</style>
